Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

feature/messaging/src/commonMain/kotlin/org/meshtastic/feature/messaging/component/MessageBubble.kt f4506450168d047b225b277620bf0f1d5dcd13b5 (f4506450) Text, 2.60 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.messaging.component

Tff7b72import T7ee787androidx.compose.foundation.shape.CornerBasedShape
Tff7b72import T7ee787androidx.compose.foundation.shape.RoundedCornerShape
Tff7b72import T7ee787androidx.compose.ui.unit.Dp
Tff7b72import T7ee787androidx.compose.ui.unit.dp

T8b949e/**
* Returns a [CornerBasedShape] for a message bubble based on its position in a sequence.
*
* Standalone bubbles are fully rounded; consecutive bubbles from the same sender flatten only the corners facing each
* other (to [groupedCornerRadius]) so a run reads as one visual group, matching the M3 conversation pattern.
*
* @param cornerRadius The base corner radius for the bubble.
* @param isSender Whether the message was sent by the local user.
* @param hasSamePrev Whether the previous message in the list is from the same sender.
* @param hasSameNext Whether the next message in the list is from the same sender.
* @param groupedCornerRadius The reduced radius used on corners adjacent to a same-sender neighbor.
*/
Tff7b72fun Td2a8ffgetMessageBubbleShapeTb4b4b4(
Te6edf3cornerRadiusTb4b4b4: Te6edf3DpTb4b4b4,
Te6edf3isSenderTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3hasSamePrevTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3hasSameNextTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3groupedCornerRadiusTb4b4b4: Te6edf3Dp Tff7b72= T79c0ff4.Te6edf3dpTb4b4b4,
Tb4b4b4)Tb4b4b4: Te6edf3CornerBasedShape Tb4b4b4{
Tff7b72val Te6edf3round Tff7b72= Te6edf3cornerRadius
Tff7b72val Te6edf3grouped Tff7b72= Te6edf3groupedCornerRadius

Tff7b72return Tff7b72if Tb4b4b4(Te6edf3isSenderTb4b4b4) Tb4b4b4{
T8b949e// Sent messages are on the right; grouped corners flatten along the end edge.
Te6edf3RoundedCornerShapeTb4b4b4(
Te6edf3topStart Tff7b72= Te6edf3roundTb4b4b4,
Te6edf3topEnd Tff7b72= Tff7b72if Tb4b4b4(Te6edf3hasSamePrevTb4b4b4) Te6edf3grouped Tff7b72else Te6edf3roundTb4b4b4,
Te6edf3bottomStart Tff7b72= Te6edf3roundTb4b4b4,
Te6edf3bottomEnd Tff7b72= Tff7b72if Tb4b4b4(Te6edf3hasSameNextTb4b4b4) Te6edf3grouped Tff7b72else Te6edf3roundTb4b4b4,
Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
T8b949e// Received messages are on the left; grouped corners flatten along the start edge.
Te6edf3RoundedCornerShapeTb4b4b4(
Te6edf3topStart Tff7b72= Tff7b72if Tb4b4b4(Te6edf3hasSamePrevTb4b4b4) Te6edf3grouped Tff7b72else Te6edf3roundTb4b4b4,
Te6edf3topEnd Tff7b72= Te6edf3roundTb4b4b4,
Te6edf3bottomStart Tff7b72= Tff7b72if Tb4b4b4(Te6edf3hasSameNextTb4b4b4) Te6edf3grouped Tff7b72else Te6edf3roundTb4b4b4,
Te6edf3bottomEnd Tff7b72= Te6edf3roundTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s